import Router from 'koa-router';
import Alipay from "../../controller/alipay";

const router = new Router();

router.prefix('/api/alipay');

router
  /**
   * @swagger
   * /api/alipay/pay:
   *   post: 
   *     description: 提交ali支付订单 
   *     tags: [支付] 
   *     summary: "支付"
   *     parameters:
  
   *     produces: 
   *       - application/json 
   *     responses: 
   *       200:
   *         description: 获取数据列表 
   * */
  .post('/pay', Alipay.pay)
  /**
   * @swagger
   * /api/alipay/cb:
   *   post: 
   *     description: 提交ali支付订单 
   *     tags: [支付] 
   *     summary: "支付"
   *     parameters:
  
   *     produces: 
   *       - application/json 
   *     responses: 
   *       200:
   *         description: 获取数据列表 
   * */
  .post('/cb', Alipay.payCallback)
  /**
   * @swagger
   * /api/alipay/payResult:
   *   get: 
   *     description: 查询支付结果 
   *     tags: [支付] 
   *     summary: "查询支付结果"
   *     parameters:
   *      - name: "out_trade_no"
   *        description: "订单号"
   *        in: "query"
   *        required: true
   *     produces: 
   *       - application/json 
   *     responses: 
   *       200:
   *         description: 获取数据列表 
   * */
  .get('/payResult', Alipay.payResult)
  /**
  * @swagger
  * /api/alipay/orderRecords:
  *   get: 
  *     description: 订单记录 
  *     tags: [支付] 
  *     summary: "订单记录"
  *     parameters:
  *      - name: "page"
  *        description: "页码"
  *        in: "query"
  *        required: true
  *      - name: "pageSize"
  *        description: "每页条数"
  *        in: "query"
  *        required: true
  *     produces: 
  *       - application/json 
  *     responses: 
  *       200:
  *         description: 获取数据列表 
  * */
  .get('/orderRecords', Alipay.orderRecords)
  /**
  * @swagger
  * /api/alipay/closeOrder:
  *   get: 
  *     description: 关闭订单 
  *     tags: [支付] 
  *     summary: "关闭订单"
  *     parameters:
  *      - name: "out_trade_no"
  *        description: "_id"
  *        in: "query"
  *        required: true
  *     produces: 
  *       - application/json 
  *     responses: 
  *       200:
  *         description: 获取数据列表 
  * */
  .put('/closeOrder', Alipay.closeOrder)

export default router;